﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Greve
{
    public class JumpCode
    {
        public String code;
		public String name;
        public double oneMeter;
        public double threeMeter;
        public double fiveMeter;
        public double sevenMeter;
        public double tenMeter;

        public JumpCode(String codev, char codec, double a, double b, double c, double d, double e)
        {
            code = codev.Trim() + codec.ToString();
			code.Replace(" ","");
            oneMeter = a;
            threeMeter = b;
            fiveMeter = c;
            sevenMeter = d;
            tenMeter = e;
        }
        public JumpCode()
        {
			
        }
		public void calcString()
		{
			if(code.Length == 4)
			{
				char[] ch = code.ToCharArray();

				if (ch[0].Equals('1'))
					name = "Forward";
				else if (ch[0].Equals('2'))
					name = "Back";
				else if (ch[0].Equals('3'))
					name = "Reverse";
				else if (ch[0].Equals('4'))
					name = "Inward";


				if (ch[1].Equals('0'))
					name += "";
				else
					name += " Flying";

				if (ch[2].Equals('0'))
					name += "";
				else if (ch[2].Equals('1'))
					name += " Dive";
				else if (ch[2].Equals('2'))
					name += " Somersault";
				else if (ch[2].Equals('3'))
					name += " 1½ Somersault";
				else if (ch[2].Equals('4'))
					name += " 2 Somersault";
				else if (ch[2].Equals('5'))
					name += " 2½ Somersault";
				else if (ch[2].Equals('6'))
					name += " 3 Somersault";
				else if (ch[2].Equals('7'))
					name += " 3½ Somersault";
				else
					name += " 4½ Somersault";

				if (ch[3].Equals('A'))
					name += " (STR)";
				else if (ch[3].Equals('B'))
					name += " (PIKE)";
				else if (ch[3].Equals('C'))
					name += " (TUCK)";
				else
					name += " (FREE)";

				if (ch[0].Equals('6'))
					name = "Armstand";
				if (ch[1].Equals('0') && ch[2].Equals('0'))
					name += " Dive";
				if (ch[0].Equals('6') && ch[1].Equals('1'))
					name += " Forward";
				else if (ch[0].Equals('6') && ch[1].Equals('2'))
					name += " Back";
				else if (ch[0].Equals('6') && ch[1].Equals('3'))
					name += " Reverse";

				if (ch[0].Equals('6') && ch[2].Equals('1'))
					name += " ½ Somersault";
				else if (ch[0].Equals('6') && ch[2].Equals('2'))
					name += " 1 Somersault";
				else if (ch[0].Equals('6') && ch[2].Equals('3'))
					name += " 1½ Somersault";
				else if (ch[0].Equals('6') && ch[2].Equals('4'))
					name += " 2 Somersault";
				else if (ch[0].Equals('6') && ch[2].Equals('6'))
					name += " 3 Somersault";

				if (ch[0].Equals('0') || ch[2].Equals('0'))
					name = "";
			}
			else
			{
				char[] ch = code.ToCharArray();

				if (ch[0].Equals('5'))
					name = "";
				else
					name = "Armstand";

				if (ch[1].Equals('1'))
					name = "Forward";
				else if (ch[1].Equals('2'))
					name = "Back";
				else if (ch[1].Equals('3'))
					name = "Reverse";
				else if (ch[1].Equals('4'))
					name = "Inward";

				if (ch[2].Equals('1'))
					name += " Dive";
				else if (ch[2].Equals('2'))
					name += " Somersault";
				else if (ch[2].Equals('3'))
					name += " 1½ Somersault";
				else if (ch[2].Equals('4'))
					name += " 2 Somersault";
				else if (ch[2].Equals('5'))
					name += " 2½ Somersault";
				else if (ch[2].Equals('6'))
					name += " 3 Somersault";
				else if (ch[2].Equals('7'))
					name += " 3½ Somersault";
				else
					name += " 4½ Somersault";

				if (ch[3].Equals('1'))
					name += " ½ Twist";
				else if (ch[3].Equals('2'))
					name += " 1 Twist";
				else if (ch[3].Equals('3'))
					name += " 1½ Twist";
				else if (ch[3].Equals('4'))
					name += " 2 Twist";
				else if (ch[3].Equals('5'))
					name += " 2½ Twist";
				else if (ch[3].Equals('6'))
					name += " 3 Twist";
				else if (ch[3].Equals('7'))
					name += " 3½ Twist";
				else
					name += " 4½ Twist";

				if (ch[4].Equals('A'))
					name += " (STR)";
				else if (ch[4].Equals('B'))
					name += " (PIKE)";
				else if (ch[4].Equals('C'))
					name += " (TUCK)";
				else
					name += " (FREE)";
			}
		}
    }
}
